#include "stdafx.hpp"
#include "ColligereAboutDialog.hpp"
#include "ColligereVersion.hpp"
#include "ColligereApp.hpp"

IMPLEMENT_DYNAMIC_CLASS ( col::AboutDialog, wxDialog );

col::AboutDialog::AboutDialog ( wxFrame *pParent )
{
	using namespace boost;

	wxXmlResource::Get()->LoadDialog ( this, pParent, "ID_Dialog_About" );

	Connect ( XRCID ("ID_HyperLink_HomePage"), wxEVT_COMMAND_HYPERLINK,
		wxHyperlinkEventHandler ( AboutDialog::OnHomepageLinkClicked ) );

	// This must be done manually since setting it in the XRC has no effect.
	XRCCTRL ( *this, "ID_StaticText_Licence", wxStaticText )->Wrap ( 300 );

	SetTitle ( _("About Colligere") );

	wxIcon app_icon ( "appicon", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16 );
	wxASSERT ( app_icon.IsOk() );
	SetIcon ( app_icon );

	if ( GetSizer() )
	{
		GetSizer()->SetSizeHints ( this );
	}

	Centre();
}

void col::AboutDialog::OnHomepageLinkClicked ( wxHyperlinkEvent &rEvt )
{
	wxLaunchDefaultBrowser ( rEvt.GetURL() );
}